//获取所需要的页面元素对象
var tbody = document.querySelector('#tbody')

getList()
function getList() {

    //用ajax的方式向后台发送get请求
    utils.fetch('./api/v1/shop/select.php').then(res => {
        
        if (res.code == 200) {
            const { list } = res.body
            var str = ''
            list.forEach((shop, index) => {

                str += `<tr data-id="${shop.Id}">
            <td>${index + 1}</td>
            <td><span>${shop.name}</span><input type="text"></td>
            <td><span>${shop.price}</span><input type="number"></td>
            <td><span>${shop.num}</span><input type="number"></td>
            <td>
                <button type="button" class="btn btn-info btn-primary btn-xs btn-edia">编辑</button>
                <button type="button" class="btn btn-danger btn-primary btn-xs btn-del">删除</button>
                <button type="button" class="btn btn-success btn-primary btn-xs btn-ok">确定</button>
                <button type="button" class="tn btn-warning btn-primary btn-xs btn-cancel">取消</button>
            </td>
            </tr>`
                tbody.innerHTML = str


            })

        }

    })
}